home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / SimpleFaro.dxr / case keeper_62_db 666.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  6.1 KB  |  171 lines

  1. property winMe, loseMe, spriteNum
  2. global deck, points, gPlayerBets, playerCredits, bettext, winSprite, loseSprite, losingDen, winningDen
  3.  
  4. on mouseEnter me
  5.   sprite(spriteNum).member = member(sprite(spriteNum).member.name & "2")
  6. end
  7.  
  8. on mouseLeave me
  9.   sprite(spriteNum).member = member(chars(sprite(spriteNum).member.name, 1, sprite(spriteNum).member.name.char.count - 1))
  10. end
  11.  
  12. on mouseDown me
  13.   bettext.text = "0"
  14.   puppetSound(3, member("deal card", "100GPak Generic SFX"))
  15.   loseMe = deck.mDrawCard(#top)
  16.   member(string(loseMe.pRank) && "text").char[3] = string(value(member(string(loseMe.pRank) && "text").char[3]) + 1)
  17.   deck.mRemoveFromDeck(loseMe)
  18.   loseSprite.member = member(loseMe.mGetImage())
  19.   puppetSound(3, member("deal card", "100GPak Generic SFX"))
  20.   winMe = deck.mDrawCard(#top)
  21.   member(string(winMe.pRank) && "text").char[1] = string(value(member(string(winMe.pRank) && "text").char[1]) + 1)
  22.   deck.mRemoveFromDeck(winMe)
  23.   winSprite.member = member(winMe.mGetImage())
  24.   repeat with i = gPlayerBets.count down to 1
  25.     if (gPlayerBets[i].pBet[#denomination] = loseMe.pRank) or (gPlayerBets[i].pBet[#denomination] = winMe.pRank) then
  26.       if gPlayerBets[i].pType = #single then
  27.         if loseMe.pRank <> winMe.pRank then
  28.           if ((gPlayerBets[i].pBet[#denomination] = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((gPlayerBets[i].pBet[#denomination] = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  29.             points = points + 100
  30.             playerCredits.text = string(points)
  31.           end if
  32.         else
  33.           if loseMe.pRank <> winMe.pRank then
  34.             if ((gPlayerBets[i].pBet[#denomination] = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((gPlayerBets[i].pBet[#denomination] = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  35.               points = points + 50
  36.               playerCredits.text = string(points)
  37.             end if
  38.           end if
  39.         end if
  40.         xtc = string(gPlayerBets.getPropAt(i))
  41.         xtc2 = value(chars(xtc, 2, xtc.char.count))
  42.         sprite(xtc2).chipPiece.loc = sprite(xtc2).chipPiece.ogLoc
  43.         sprite(xtc2).alreadyBetOn = 0
  44.         gPlayerBets[i].mRemoveBet(gPlayerBets.getPropAt(i))
  45.         updateStage()
  46.       end if
  47.       next repeat
  48.     end if
  49.     if gPlayerBets[i].pType = #set then
  50.       repeat with u in gPlayerBets[i].pBet[#denomination]
  51.         if (u = loseMe.pRank) or (u = winMe.pRank) then
  52.           if loseMe.pRank <> winMe.pRank then
  53.             put gPlayerBets[i].pBet[#outcome]
  54.             if ((u = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((u = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  55.               points = points + 100
  56.               playerCredits.text = string(points)
  57.             end if
  58.           else
  59.             if loseMe.pRank = winMe.pRank then
  60.               if ((u = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((u = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  61.                 points = points + 50
  62.                 playerCredits.text = string(points)
  63.               end if
  64.             end if
  65.           end if
  66.           xtc = string(gPlayerBets.getPropAt(i))
  67.           xtc2 = value(chars(xtc, 2, xtc.char.count))
  68.           sprite(xtc2).chipPiece.loc = sprite(xtc2).chipPiece.ogLoc
  69.           sprite(xtc2).alreadyBetOn = 0
  70.           gPlayerBets[i].mRemoveBet(gPlayerBets.getPropAt(i))
  71.           updateStage()
  72.         end if
  73.       end repeat
  74.       next repeat
  75.     end if
  76.     if gPlayerBets[i].pType = #special then
  77.       if gPlayerBets[i].pBet[#denomination] = #high then
  78.         if ((getValue(winMe.pRank) >= 7) and (gPlayerBets[i].pBet[#outcome] = #win)) or ((getValue(winMe.pRank) < 7) and (gPlayerBets[i].pBet[#outcome] = #lose)) then
  79.           points = points + 50
  80.           playerCredits.text = string(points)
  81.           updateStage()
  82.         else
  83.           points = points - 50
  84.           playerCredits.text = string(points)
  85.           updateStage()
  86.         end if
  87.         next repeat
  88.       end if
  89.       if gPlayerBets[i].pBet[#denomination] = #odd then
  90.         if (((getValue(winMe.pRank) mod 2) <> 0) and (gPlayerBets[i].pBet[#outcome] = #win)) or (((getValue(winMe.pRank) mod 2) = 0) and (gPlayerBets[i].pBet[#outcome] = #lose)) then
  91.           points = points + 50
  92.           playerCredits.text = string(points)
  93.           updateStage()
  94.         else
  95.           points = points - 50
  96.           playerCredits.text = string(points)
  97.           updateStage()
  98.         end if
  99.         updateStage()
  100.       end if
  101.     end if
  102.   end repeat
  103.   gPlayerBets.deleteAll()
  104.   winMe = VOID
  105.   loseMe = VOID
  106.   deck = VOID
  107.   deck = new(script("deck of cards"))
  108.   deck.mRemoveFromDeck(deck.mDrawCard(#top))
  109.   if points <= 0 then
  110.   else
  111.     repeat with i in ["ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "jack", "queen", "king"]
  112.       member(i && "text").text = "0/0"
  113.     end repeat
  114.     go(2)
  115.   end if
  116. end
  117.  
  118. on getValue arg
  119.   if arg = #ace then
  120.     return 1
  121.   else
  122.     if arg = #two then
  123.       return 2
  124.     else
  125.       if arg = #three then
  126.         return 3
  127.       else
  128.         if arg = #four then
  129.           return 4
  130.         else
  131.           if arg = #five then
  132.             return 5
  133.           else
  134.             if arg = #six then
  135.               return 6
  136.             else
  137.               if arg = #seven then
  138.                 return 7
  139.               else
  140.                 if arg = #eight then
  141.                   return 8
  142.                 else
  143.                   if arg = #nine then
  144.                     return 9
  145.                   else
  146.                     if arg = #ten then
  147.                       return 10
  148.                     else
  149.                       if arg = #jack then
  150.                         return 11
  151.                       else
  152.                         if arg = #queen then
  153.                           return 12
  154.                         else
  155.                           if arg = #king then
  156.                             return 13
  157.                           end if
  158.                         end if
  159.                       end if
  160.                     end if
  161.                   end if
  162.                 end if
  163.               end if
  164.             end if
  165.           end if
  166.         end if
  167.       end if
  168.     end if
  169.   end if
  170. end
  171.